package com.youkeda.app.control;

import com.youkeda.app.model.MatchData;
import com.youkeda.app.model.Result;
import com.youkeda.app.service.MatchDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author 刘正星
 * @version 1.0.0
 * @ClassName MatchDataController.java
 * @Description TODO
 * @createTime 2020年10月03日 14:13:00
 */

@Controller
@RequestMapping(value = "/matchdata")
public class MatchDataController {
    @Autowired
    private MatchDataService matchDataService;

    @PostMapping("/add")
    @ResponseBody
    public Result<Integer> add(@RequestBody MatchData matchData) {

        Result<Integer> result = new Result<>();
        if (matchData.getId() != null) {
            return result;
        }

        Integer addNum = matchDataService.add(matchData);
        result.setData(addNum);
        if (addNum > 0) {
            result.setSuccess(true);
        }

        return result;

    }
}
